Skip to contentSkip to conversation

Change in openvpn[master]: repair DNS address option

Openvpn-devel In review stipa (Code Review) 2 participants 6 messages Dec 24, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1735056384000.I87e4593e6a548bacd40b840cd241950019fa457d@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/845?usp=email

to review the following change.

Change subject: repair DNS address option
......................................................................

repair DNS address option

Commit

6f2d222 ("dns: store IPv4 addresses in network byte order")

changed the internal representation of IPv4 address within DNS settings to network byte order, however later this value is copied into tuntap_options, where IPv4 addresses are assumed to be in host byte order (see lots of occurences of "htonl(tt->" in tun.c). As a consequence, DNS server address is set incorrectly, like 4.4.8.8 instead of 8.8.4.4

Fix by converting address to host byte order when copying from DNS options to tuntap_options.

Change-Id I87e4593e6a548bacd40b840cd241950019fa457d

---
M src/openvpn/options.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/45/845/1

src/openvpn/options.c +1 -1
index b2a3a8b..20e8d55 100644
@@ -1390,7 +1390,7 @@
                         overflow = true;
                         continue;
                     }
-                    tt->dns[tt->dns_len++] = server->addr[i].in.a4.s_addr;
+                    tt->dns[tt->dns_len++] = ntohl(server->addr[i].in.a4.s_addr);
                 }
                 else
                 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/845?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I87e4593e6a548bacd40b840cd241950019fa457d
Gerrit-Change-Number: 845
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/845?usp=email )

Change subject: repair DNS address option
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/845?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I87e4593e6a548bacd40b840cd241950019fa457d
Gerrit-Change-Number: 845
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Tue, 24 Dec 2024 17:42:12 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH 1/1 repair DNS address option

In reply to a message not in the archive

From: Lev Stipakov <[email protected]...>

Commit

6f2d222 ("dns: store IPv4 addresses in network byte order")

changed the internal representation of IPv4 address within DNS settings to network byte order, however later this value is copied into tuntap_options, where IPv4 addresses are assumed to be in host byte order (see lots of occurences of "htonl(tt->" in tun.c). As a consequence, DNS server address is set incorrectly, like 4.4.8.8 instead of 8.8.4.4

Fix by converting address to host byte order when copying from DNS options to tuntap_options.

Change-Id I87e4593e6a548bacd40b840cd241950019fa457d

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/845
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/options.c +1 -1
index b2a3a8b..20e8d55 100644
@@ -1390,7 +1390,7 @@
                         overflow = true;
                         continue;
                     }
-                    tt->dns[tt->dns_len++] = server->addr[i].in.a4.s_addr;
+                    tt->dns[tt->dns_len++] = ntohl(server->addr[i].in.a4.s_addr);
                 }
                 else
                 {
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: repair DNS address option

"Obviously correct". Sorry for overlooking this part.

Did not actually run a windows binary, but did a mingw test compile.

Your patch has been applied to the master branch.

commit 82fd89a04f774eeb785ad110dd6923a12345f973

Author: Lev Stipakov
Date:   Tue Dec 24 18:42:33 2024 +0100
     repair DNS address option

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg30195.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/845?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: repair DNS address option
......................................................................

repair DNS address option

Commit

6f2d222 ("dns: store IPv4 addresses in network byte order")

changed the internal representation of IPv4 address within DNS settings to network byte order, however later this value is copied into tuntap_options, where IPv4 addresses are assumed to be in host byte order (see lots of occurences of "htonl(tt->" in tun.c). As a consequence, DNS server address is set incorrectly, like 4.4.8.8 instead of 8.8.4.4

Fix by converting address to host byte order when copying from DNS options to tuntap_options.

Change-Id I87e4593e6a548bacd40b840cd241950019fa457d

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30195.html

---
M src/openvpn/options.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/45/845/2

src/openvpn/options.c +1 -1
index b2a3a8b..20e8d55 100644
@@ -1390,7 +1390,7 @@
                         overflow = true;
                         continue;
                     }
-                    tt->dns[tt->dns_len++] = server->addr[i].in.a4.s_addr;
+                    tt->dns[tt->dns_len++] = ntohl(server->addr[i].in.a4.s_addr);
                 }
                 else
                 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/845?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I87e4593e6a548bacd40b840cd241950019fa457d
Gerrit-Change-Number: 845
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/845?usp=email )

Change subject: repair DNS address option
......................................................................

repair DNS address option

Commit

6f2d222 ("dns: store IPv4 addresses in network byte order")

changed the internal representation of IPv4 address within DNS settings to network byte order, however later this value is copied into tuntap_options, where IPv4 addresses are assumed to be in host byte order (see lots of occurences of "htonl(tt->" in tun.c). As a consequence, DNS server address is set incorrectly, like 4.4.8.8 instead of 8.8.4.4

Fix by converting address to host byte order when copying from DNS options to tuntap_options.

Change-Id I87e4593e6a548bacd40b840cd241950019fa457d

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30195.html

---
M src/openvpn/options.c

1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/options.c +1 -1
index b2a3a8b..20e8d55 100644
@@ -1390,7 +1390,7 @@
                         overflow = true;
                         continue;
                     }
-                    tt->dns[tt->dns_len++] = server->addr[i].in.a4.s_addr;
+                    tt->dns[tt->dns_len++] = ntohl(server->addr[i].in.a4.s_addr);
                 }
                 else
                 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/845?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I87e4593e6a548bacd40b840cd241950019fa457d
Gerrit-Change-Number: 845
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged